/*
 * @lc app=leetcode.cn id=1768 lang=typescript
 *
 * [1768] 交替合并字符串
 */

// @lc code=start
function mergeAlternately(word1: string, word2: string): string {
    let i = 0;
    let result = "";
    let max = Math.max(word1.length, word2.length);
    while (i < max) {
        result += (word1[i] || "") + (word2[i] || "");
        i++;
    }
    return result;
}
// @lc code=end
